/*
 *  $Id: Reincarnation.cs 975 2009-12-16 17:13:22Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Affects {
    /// <summary>
    /// Эффект: реинкарнация
    /// Параметр: мин.бросок для срабатывания
    /// Существо воскрешается при смерти, если выпадает X или больше.
    /// </summary>
    public class Reincarnation: FlagAffect {
        public static readonly Languages.Phrase Try = new Languages.Phrase("affect.reincarnation.try");

        public readonly int Value;

        public Reincarnation(int value) {
            Value = value;
        }

        public override string Id {
            get { return "reincarnation"; }
        }
        public override string NameText {
            get { return Name.GetText(Value); }
        }

        public override int BaseWeight {
            get { return (7-Value) * 50; }
        }

        public override AffectIcon Icon {
            get { return AffectIcon.Reincarnation; }
        }

        public override Affect Clone() {
            return new Reincarnation(Value);
        }

        public override void SetAffect() {
            base.SetAffect();
            LocalSummary.Reincarnation.Add(this);
        }
        public override void ResetAffect() {
            base.ResetAffect();
            LocalSummary.Reincarnation.Remove(this);
        }

        public static int Comparison(Reincarnation a, Reincarnation b) {
            return a.Value.CompareTo(b.Value);
        }
    }
}